<template>
  <div>
    <a-card>
      <a-row style="margin-bottom: 10px">
        <a-col :span="24"  style="display: flex;flex-direction: row-reverse">
          <a-button v-print="'#printReport'" type="primary">打印报表</a-button>
        </a-col>
      </a-row>
      <div id="printReport">
        <table border="1" cellpadding="4" cellspacing="0" bordercolor="#000" style="width: 100%">
          <tr>
            <th colspan="10">
              <div style="position: relative;text-align: center">
                <img src="@/assets/reportIcon.png" width="100px" height="25px" style="position: absolute;left: 0px;top:-2px"/>
                <span>{{ type === 'SMT' ? 'SMT巡检记录表' : type === 'DIP' ? 'DIP巡检记录表' : '成品组装巡检记录表'}}</span>
              </div>
            </th>
          </tr>
          <tr>
            <td colspan="10">
              <a-row>
                <a-col :span="6"><span>产品型号：{{reportData.produceTypeNum}}</span></a-col>
                <a-col :span="6"><span>日期：{{reportData.inspectDate}}</span></a-col>
                <a-col :span="6"><span>班别：{{reportData.inspectFrequen}}</span></a-col>
                <a-col :span="6"><span>生产线别：{{reportData.lineType}}</span></a-col>
              </a-row>
            </td>
          </tr>
          <tr style="width: 100%" align="center">
            <th>序号</th>
            <th>项目</th>
            <th>巡检内容</th>
            <th colspan="6">巡检频率2H/次</th>
            <th>改善状况</th>
          </tr>
          <tr v-for="(item,index) in reportData.patrolInspectLogs">
            <td>{{ index + 1 }}</td>
            <td>{{ item.patrolInspectProject }}</td>
            <td>{{ item.patrolInspectContent }}</td>
            <td>{{item.patrolUps[0] ? (item.patrolUps[0] === 'true' ? '√' : '×') : ''}}</td>
            <td>{{item.patrolUps[1] ? (item.patrolUps[1] === 'true' ? '√' : '×') : ''}}</td>
            <td>{{item.patrolUps[2] ? (item.patrolUps[2] === 'true' ? '√' : '×') : ''}}</td>
            <td>{{item.patrolUps[3] ? (item.patrolUps[3] === 'true' ? '√' : '×') : ''}}</td>
            <td>{{item.patrolUps[4] ? (item.patrolUps[4] === 'true' ? '√' : '×') : ''}}</td>
            <td>{{item.patrolUps[5] ? (item.patrolUps[5] === 'true' ? '√' : '×') : ''}}</td>
            <td>{{ item.patrolState }}</td>
          </tr>
          <tr>
            <th rowspan="4" colspan="10">备注：<br>
              <span>1.检查合格打“√”，不合格打“×”</span><br>
              <span>2.IPQC如实记录查验结果</span><br>
              <span>3.不符合项与现场主管确认并记录改善状况</span><br>
            </th>
          </tr>
        </table>
        <div style="width: 100%;font-weight: bold;margin-top: 20px">IPQC执行: {{ reportData.createBy }}</div>
        <div v-if="type === 'SMT'" style="display: flex;justify-content: space-between">
          <div>文件编号:YZY-QRQC-088</div>
          <div>保存期限:1年</div>
          <div>版本:1.0</div>
        </div>
        <div v-if="type === 'DIP'" style="display: flex;justify-content: space-between">
          <div>文件编号:YZY-QRQC-110</div>
          <div>保存期限:1年</div>
          <div>版本:1.0</div>
        </div>
      </div>
    </a-card>
  </div>
</template>

<script>
export default {
  /** SMT巡检记录表 **/
  name: 'SMTInspectionRecords',
  props:{
    reportData:{
      type:Object,
      default:()=>{}
    },
    type:{
      type:String,
      default:''
    }
  },
}
</script>

<style scoped>

</style>